#pragma once
#include "stdafx.h"
#include "Operator.h"
#include "QueueEntity.h"
#include "LineageSynopsis.h"
#include "RelationSynopsis.h"
#include "Operator.h"
#include "ElementIterator.h"
#include <boost/shared_ptr.hpp>
#include <boost/unordered_map.hpp>
enum AggregateOperation
{
	SUM,
	AVG,
	COUNT
};
class GroupAggregationOperator:public Operator
{
private:
	boost::shared_ptr<RelationSynopsis>relationSynopsis; 
	boost::shared_ptr<LineageSynopsis>lineageSynopsis;
	std::map<std::string, std::set<DocumentId> > groupMap;
	std::string groupByAttributeName;
	std::string aggregationAttributeName;
	std::string resultAttributeName;
	AggregateOperation aggregateOperation;
public:
	GroupAggregationOperator(void);
	~GroupAggregationOperator(void);
	void execution(int executionTimes);
	void setGroupByAttributeName(std::string groupByAttributeName );
	void setAggregationAttributeName(std::string aggregationAttributeName);
	void setResultAttributeName(std::string resultAttributeName);
	void setAggregateOperation(AggregateOperation& aggregateOperation);
	
};

